

package com.hazelcast.internal.util.executor;

import com.hazelcast.spi.impl.NodeEngine;

/**
 * This factory is implemented to have a thread factory that creates threads with `UnblockableThread` interface.
 * see @{@link UnblockableThread}
 */
public class UnblockablePoolExecutorThreadFactory extends PoolExecutorThreadFactory {

    public UnblockablePoolExecutorThreadFactory(String threadNamePrefix, ClassLoader classLoader, NodeEngine engine) {
        super(threadNamePrefix, classLoader, engine);
    }

    @Override
    protected ManagedThread createThread(Runnable r, String name, int id) {
        return new UnblockableManagedThread(r, name, id);
    }

    private class UnblockableManagedThread extends ManagedThread implements UnblockableThread {

        UnblockableManagedThread(Runnable target, String name, int id) {
            super(target, name, id);
        }
    }
}
